package com.mypackage.diary.model;

// Generated Nov 7, 2014 12:02:55 AM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "category", catalog = "diary")
public class Category implements java.io.Serializable {

	private int idCategory;
	private Userprofile userprofile;
	private String name;
	private Integer parentId;
	private Date create;
	private Date modified;
	private Set<Diary> diaries = new HashSet<Diary>(0);

	public Category() {
	}

	public Category(int idCategory, Userprofile userprofile, String name) {
		this.idCategory = idCategory;
		this.userprofile = userprofile;
		this.name = name;
	}

	public Category(int idCategory, Userprofile userprofile, String name,
			Integer parentId, Date create, Date modified, Set<Diary> diaries) {
		this.idCategory = idCategory;
		this.userprofile = userprofile;
		this.name = name;
		this.parentId = parentId;
		this.create = create;
		this.modified = modified;
		this.diaries = diaries;
	}

	@Id
	@Column(name = "idCategory", unique = true, nullable = false)
	public int getIdCategory() {
		return this.idCategory;
	}

	public void setIdCategory(int idCategory) {
		this.idCategory = idCategory;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AuthorId", nullable = false)
	public Userprofile getUserprofile() {
		return this.userprofile;
	}

	public void setUserprofile(Userprofile userprofile) {
		this.userprofile = userprofile;
	}

	@Column(name = "Name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ParentId")
	public Integer getParentId() {
		return this.parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Create", length = 19)
	public Date getCreate() {
		return this.create;
	}

	public void setCreate(Date create) {
		this.create = create;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Modified", length = 19)
	public Date getModified() {
		return this.modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "diaryincategory", catalog = "diary", joinColumns = { @JoinColumn(name = "CategoryId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "DiaryId", nullable = false, updatable = false) })
	public Set<Diary> getDiaries() {
		return this.diaries;
	}

	public void setDiaries(Set<Diary> diaries) {
		this.diaries = diaries;
	}

}
